#pragma once

#include "winos.h"
#include <Rpc.h>

_SSL_BEGIN
_SSWINOSL_BEGIN

_SSBASEL_USE_NP

#define rpc_try RpcTryExcept
#define rpc_catch_all RpcExcept(1)
#define rpc_end_catch RpcEndExcept
#define rpc_throw_exception(e) RpcRaiseException(e)

#define rpc_exception_code RpcExceptionCode()

#ifdef _UNICODE
#define rpc_string_type unsigned short *
#else
#define rpc_string_type unsigned char *
#endif

SSWINOS_API RPC_STATUS rpc_server_active(RPC_IF_HANDLE h, unsigned int min_calls, unsigned int max_calls,
	const tchar *end_point, unsigned int dnot_wait);
SSWINOS_API RPC_STATUS rpc_server_wait();
SSWINOS_API RPC_STATUS rpc_server_deactive(RPC_IF_HANDLE h);

SSWINOS_API void* rpc_client_connect(RPC_BINDING_HANDLE *h, const tchar *end_point, const tchar *net_addr);
SSWINOS_API RPC_STATUS rpc_client_disconnect(RPC_BINDING_HANDLE *h, void *rpc_bind_string);

_SSWINOSL_END
_SSL_END
